package qrcode;

import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
 
//import java.awt.Dimension;
 
public class GUIDisplay extends JFrame {
 
    public static void main(String args[]) {
        GUIDisplay d = new GUIDisplay();
        d.setVisible(true);
    }
 
    private static final long serialVersionUID = 1L;
    private JPanel jContentPane = null;
    private java.awt.image.BufferedImage image = null;
 
    /**
     * This is the default constructor
     */
    public GUIDisplay() {
        super();
        initialize();
        EnCodeTest qrcode = new EnCodeTest();
        try {
            java.awt.MediaTracker mt = new java.awt.MediaTracker(this);
            // for Applet, change the method to retrieve the image
            // and of course use your own image!
            image = qrcode.makeqrcode();
            mt.addImage(image, 0);
            mt.waitForID(0);
        } catch (Exception e) {
            e.printStackTrace();
        }
 
    }
 
    /**
     * This method initializes this
     * 
     * @return void
     */
    private void initialize() {
        this.setSize(300, 307);
        this.setContentPane(getJContentPane());
        this.setTitle("JFrame");
    }
 
    /**
     * This method initializes jContentPane
     * 
     * @return javax.swing.JPanel
     */
    private JPanel getJContentPane() {
        if (jContentPane == null) {
            jContentPane = new JPanel();
            jContentPane.setLayout(new BorderLayout());
        }
        return jContentPane;
    }
 
    public void update(java.awt.Graphics g) {
        paint(g);
    }
 
    public void paint(java.awt.Graphics g) {
        if (image != null) {
            g.drawImage(image, 20, 50, this);
        } else {
            g.clearRect(0, 0, getSize().width, getSize().height);
        }
    }
 
} // @jve:decl-index=0:visual-constraint="10,10"